Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing Ubuntu prerequisite to installation instructions #1547

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

andreped
Copy link
Contributor

@andreped andreped commented Sep 14, 2023

Summary

I have added a missing installation instruction necessary to install monailabel on Ubuntu.

Issue

If you attempt to install monailabel through pip on Ubuntu, you need python3-dev. This is due to the openslide-python dependency that needs to be compiled during installation (see here for more information about this issue).

If not, installation will fail resulting in the error log:

Logs
Building wheels for collected packages: openslide-python
  Building wheel for openslide-python (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/UserName/Documents/Code/Public/MONAILabel/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gokcgsel/openslide-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gokcgsel/openslide-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-18fput0p
       cwd: /tmp/pip-install-gokcgsel/openslide-python/
  Complete output (24 lines):
  /tmp/pip-install-gokcgsel/openslide-python/setup.py:19: DistDeprecationWarning: Features are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.
    'performance': Feature(
  /usr/lib/python3.8/distutils/core.py:108: DistDeprecationWarning: Features are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.
    _setup_distribution = dist = klass(attrs)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/openslide
  copying openslide/deepzoom.py -> build/lib.linux-x86_64-3.8/openslide
  copying openslide/_version.py -> build/lib.linux-x86_64-3.8/openslide
  copying openslide/__init__.py -> build/lib.linux-x86_64-3.8/openslide
  copying openslide/lowlevel.py -> build/lib.linux-x86_64-3.8/openslide
  running build_ext
  building 'openslide._convert' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/openslide
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/UserName/Documents/Code/Public/MONAILabel/venv/include -I/usr/include/python3.8 -c openslide/_convert.c -o build/temp.linux-x86_64-3.8/openslide/_convert.o
  openslide/_convert.c:20:10: fatal error: Python.h: No such file or directory
     20 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for openslide-python
  Running setup.py clean for openslide-python
Failed to build openslide-python
Installing collected packages: openslide-python
    Running setup.py install for openslide-python ... error
    ERROR: Command errored out with exit status 1:
     command: /home/UserName/Documents/Code/Public/MONAILabel/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gokcgsel/openslide-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gokcgsel/openslide-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vje_xlb7/install-record.txt --single-version-externally-managed --compile --install-headers /home/UserName/Documents/Code/Public/MONAILabel/venv/include/site/python3.8/openslide-python
         cwd: /tmp/pip-install-gokcgsel/openslide-python/
    Complete output (24 lines):
    /tmp/pip-install-gokcgsel/openslide-python/setup.py:19: DistDeprecationWarning: Features are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.
      'performance': Feature(
    /usr/lib/python3.8/distutils/core.py:108: DistDeprecationWarning: Features are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.
      _setup_distribution = dist = klass(attrs)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/openslide
    copying openslide/deepzoom.py -> build/lib.linux-x86_64-3.8/openslide
    copying openslide/_version.py -> build/lib.linux-x86_64-3.8/openslide
    copying openslide/__init__.py -> build/lib.linux-x86_64-3.8/openslide
    copying openslide/lowlevel.py -> build/lib.linux-x86_64-3.8/openslide
    running build_ext
    building 'openslide._convert' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/openslide
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/UserName/Documents/Code/Public/MONAILabel/venv/include -I/usr/include/python3.8 -c openslide/_convert.c -o build/temp.linux-x86_64-3.8/openslide/_convert.o
    openslide/_convert.c:20:10: fatal error: Python.h: No such file or directory
       20 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/UserName/Documents/Code/Public/MONAILabel/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gokcgsel/openslide-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gokcgsel/openslide-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-vje_xlb7/install-record.txt --single-version-externally-managed --compile --install-headers /home/UserName/Documents/Code/Public/MONAILabel/venv/include/site/python3.8/openslide-python Check the logs for full command output.

This error was observed on Ubuntu 20.04 with Python 3.8 attempting to install latest release of monailabel from PyPI.

Note that a PR to build precompiled binaries of openslide-python has been made, so this might not be an issue in the future, but the PR has yet to be merged or included in the latest release (see openslide/openslide-python#188)

@andreped
Copy link
Contributor Author

Forgot to sign off commit, so I fixed it in a new commit.

@SachidanandAlle SachidanandAlle merged commit 1f00c6b into Project-MONAI:main Oct 12, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants